const mock=require('mockjs')

const Random=mock.Random

let Result={
    code:200,
    msg:'操作成功',
    data:null
}

mock.mock('/menu/getMenu','get',()=>{
    Result.data={
        menuList:[
            {
                name:'Index',
                title:'系统管理',

                icon:'el-icon-s-operation',
                component:'',
                children:[
                    {
                        name:'SysUser',
                        index:'1-1',
                        icon:'el-icon-s-custom',
                        title:'用户管理',
                        component:'/sys/User',
                        children:[]
                    },
                    {
                        name:'SysRole',
                        icon:'el-icon-s-custom',
                        title:'角色管理',
                        component:'/sys/Role',
                        children:[]
                    },
                    {
                        name:'SysMenu',
                        icon:'el-icon-s-custom',
                        title:'菜单管理',
                        component:'/sys/Menu',
                        children:[]
                    },

                ]
            },
            {
                name:'SysTool',
                title:'系统工具',
                icon:'el-icon-s-tools',
                component: '',
                children:[
                    {
                        name:'',
                        icon:'el-icon-s-order',
                        title:'数字字典',
                        component:'/sys/User',
                        children:[]
                    }
                ]
            }
        ],
        authorities:[

        ]
    }
    return Result;
})
mock.mock('/captcha','get',()=>{
    Result.data={
        uuid:Random.string(32),
        captchaImg:Random.dataImage('200x60','p7n5w')
    }
    return Result;
})
mock.mock('/user/upPassword','put',()=>{
    Result.code=200
    Result.msg="修改成功"
    return Result;
})
mock.mock('/menu/getMenuAll','get',()=>{
    Result.code=200
    Result.data=[
        {
            id:1,
            status:1,
            parentId:0,
            name:'系统管理',
            path:'',
            perms:'sys:manage',
            component:'',
            type:0,
            children:[
                {
                    id:101,
                    status:1,
                    parentId:1,
                    name:'用户管理',
                    path:'',
                    perms:'user:manage',
                    component:'',
                    type:1,
                    children:[
                        {
                            id:10101,
                            status:1,
                            parentId:101,
                            name:'删除用户',
                            path:'',
                            perms:'user:manage：delete',
                            component:'',
                            type:1,
                            children:[ ]
                        },
                        {
                            id:10102,
                            status:1,
                            parentId:101,
                            name:'新增用户',
                            path:'',
                            perms:'user:manage：save',
                            component:'',
                            type:1,
                            children:[ ]
                        },
                        {
                            id:10103,
                            status:1,
                            parentId:101,
                            name:'修改用户信息',
                            path:'',
                            perms:'user:manage：update',
                            component:'',
                            type:1,
                            children:[ ]
                        },
                        {
                            id:10104,
                            status:1,
                            parentId:101,
                            name:'分配角色',
                            path:'',
                            perms:'user:manage：role',
                            component:'',
                            type:1,
                            children:[ ]
                        },
                    ],
                }
            ]
        }
    ]
    return Result;
})
mock.mock('/role/delRole/1','get',()=>{
    return Result;
})

mock.mock('/login','post',()=>{
    Result.code=403
    return Result;
})
mock.mock('/user/logout','post',()=>{
    return Result;
})
mock.mock('/user/userInfo','get',()=>{
    Result.data={
        userInfo:{
            userId:"1",
            username:"text",
            avatar:"https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
        }
    }
    return Result;
})